<script setup>
import { Close } from '@element-plus/icons-vue';
import { useRoute,useRouter } from 'vue-router';
import { useTabStore } from '@/stores/tabs-routes';
const tabStore = useTabStore()
const route = useRoute()
const router = useRouter()
defineProps({
  tab: Object,
})
</script>
<template>
  <div class="tagtool" @click="router.push(tab.path)">
    <span :class="{ 'tag-active': route.path === tab.path }">{{ tab.title }}</span>
    <el-icon @click="tabStore.removeTab(tab.path)" v-if="tab.path !== '/dashboard'">
      <Close />
    </el-icon>
  </div>
</template>
<style scoped lang="scss">
.tagtool {
  background-color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 5px;

  span {
    color: #000;
    font-size: 14px;
  }

  .el-icon:hover {
    color: rgba(54, 173, 105, 0.9);
  }


  .tag-active {
    color: rgba(54, 173, 105, 0.9);
  }
}
</style>
